import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: hp
 * Date: 2024-04-27
 * Time: 20:16
 */
class Student {
    public String ID;

    public Student(String ID) {
        this.ID = ID;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return Objects.equals(ID, student.ID);
    }

    @Override
    public int hashCode() {
        return Objects.hash(ID);
    }
}

public class Test {
    public static void main(String[] args) {
        Student student1 = new Student("312023211");
        HashBucket2<Student,Double> hashBucket2 = new HashBucket2<>();
        hashBucket2.put(student1,100.10);
        Student student2 = new Student("312023211");
        System.out.println(student1.hashCode());
        System.out.println(student2.hashCode());
        System.out.println(hashBucket2.getKey(student1));
        System.out.println(hashBucket2.getKey(student2));

    }

    public static void main4(String[] args) {
        Student student1 = new Student("123");
        Student student2 = new Student("123");
        System.out.println(student1.hashCode());
        System.out.println(student2.hashCode());
    }

    public static void main3(String[] args) {
        HashBucket hashBucket = new HashBucket();
        hashBucket.put(3,3);
        hashBucket.put(4,43);
        hashBucket.put(5,533);
        hashBucket.put(6,633);
        hashBucket.put(7,733);
        hashBucket.put(8,833);
        hashBucket.put(13,133);
        hashBucket.put(23,233);
        hashBucket.put(33,3133);
        hashBucket.put(43,433);
        hashBucket.put(413,41133);
        hashBucket.put(423,42233);

        System.out.println(hashBucket.getKey(33));
    }

    public static void main2(String[] args) {
        Set<String> set = new TreeSet<>();
        set.add("abc");
        //set.add("abc");
        set.add("def");
        String s = "abc";
        System.out.println(s.length());

        Iterator<String> iterator = set.iterator();
        while(iterator.hasNext()) {
            System.out.println(iterator.next());
        }
       //System.out.println(set);
    }

    public static void main1(String[] args) {
        Map<String,String> map = new TreeMap<>();
        map.put("帅哥","王");
        //map.put("帅哥","王1");
        map.put("学霸","锟");

        /*String val = map.get("帅哥");
        System.out.println(val);

        String val1 = map.getOrDefault("装逼猪全国第三本科","纯jr");
        System.out.println(val1);

        String val2 = map.remove("学霸");
        System.out.println(val2);*/

        /*Set<String> set = map.keySet();
        System.out.println(set);*/

        Set<Map.Entry<String,String>> entries = map.entrySet();

        for(Map.Entry<String,String> entrie : entries) {
            System.out.println("key: " + entrie.getKey() + " val: " + entrie.getValue());
        }


        /*System.out.println(entries);

        for(Map.Entry<String,String> entrie : entries) {
            System.out.println(entrie);
        }*/


    }
}
